if [%*] == [] goto :cmake
call:%*
goto :eof

:cmake
    call d:\MicrosoftVisualStudio\2022\BuildTools\Common7\Tools\VsDevCmd.bat
    mkdir out
    pushd out
    cmake ../src
    cmake --build .
    for %%i in (*.exe) do %%i 17
    popd
goto :eof

:build
    call d:\MicrosoftVisualStudio\2022\BuildTools\Common7\Tools\VsDevCmd.bat
    @setlocal EnableDelayedExpansion
    @REM setlocal
    @REM pushd %cd%
    @REM for /R . %%f in (*.cpp) do ( set src_file=!src_file! "%%f" )
    @set src_file=
    @for %%f in (*.cpp) do @set src_file=!src_file! %%f

    @REM popd
    cl.exe /EHsc %src_file%
    endlocal
    @REM setlocal DisableDelayedExpansion

    @for %%i in (*.exe) do %%i
goto :eof

:clean
    for %%i in (*.exe *.obj) do del %%i
    rm -rf out
goto :eof
